package com.woniu.service.impl;

import com.woniu.Result;
import com.woniu.pojo.Circle;
import com.woniu.mapper.CircleMapper;
import com.woniu.service.ICircleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author dong
 * @since 2022-11-17
 */
@Service
public class CircleServiceImpl extends ServiceImpl<CircleMapper, Circle> implements ICircleService {

    @Autowired(required = false)
    private CircleMapper circleMapper;

    @Override
    public Result<String> saveCircle(Circle circle, int userId) {
        int row = circleMapper.saveCarCircle(circle, userId);
        return row == 1 ? Result.ok("发布成功") : Result.fail("发布失败");
    }

    @Override
    public Result<String> removeCircle(Integer id, int userId) {
        int row = circleMapper.removeCarCircle(id, userId);
        return row == 1 ? Result.ok("删除成功") : Result.fail("删除失败");
    }
}
